#! /bin/bash

if [ -n "$1" ] ;then
   db=$1
else 
   echo "请传入数据库名称"
   exit
fi 

ods_log="
drop table if exists ods_log;
CREATE EXTERNAL TABLE ods_log (line string)
PARTITIONED BY (dt string)
STORED AS 
  INPUTFORMAT 'com.hadoop.mapred.DeprecatedLzoTextInputFormat'
  OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION '/warehouse/$db/ods/ods_log'
"

hive -e "use $db;$ods_log";
